using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace DataLayerTest.Models.Mapping
{
    public class FitbitDataMap : EntityTypeConfiguration<FitbitData>
    {
        public FitbitDataMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            // Table & Column Mappings
            this.ToTable("FitbitData");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.IdFitbitAccount).HasColumnName("IdFitbitAccount");
            this.Property(t => t.Steps).HasColumnName("Steps");
            this.Property(t => t.Floors).HasColumnName("Floors");
            this.Property(t => t.Distance).HasColumnName("Distance");
            this.Property(t => t.Date).HasColumnName("Date");

            // Relationships
            this.HasRequired(t => t.FitbitAccount)
                .WithMany(t => t.FitbitDatas)
                .HasForeignKey(d => d.IdFitbitAccount);

        }
    }
}
